using Godot;
public class SteamCrusherBlock : BlockMaterial
{
    public SteamCrusherBlock() : base("steam_crusher")
    {
        SetDisplayName("蒸汽粉碎机");
        SetCollide(false);
        SetView(true);
        SetTickEvent(Tick);
        SetBlockEntityCreate(() => new SteamCrusherBlockEntity());
    }
    public override bool OnUse(PlayerUseBlockEvent e)
    {
        SteamCrusherView SCV = GD.Load<PackedScene>("res://Tscn/Store/SteamCrusherView.tscn").Instance<SteamCrusherView>();
        SCV.SetBlock(e.block);
        e.player.view.SetOpenView(SCV);
        return true;
    }
    public void Tick(UpdataTickEvent e)
    {
        SteamCrusherBlockEntity scbe = (SteamCrusherBlockEntity)e.block.blockEntity;
        BlockData top = e.TopBlock();
        if (scbe.Pace == SteamCrusherBlockEntity.MaxPace)
        {
            if (top != null && top.Name == "air")
            {
                top.SetBlock(Materials.SteamBlock);
            }
        }
        else
        {

        }
    }

}